<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%@ include file="../../../../header.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<style type="text/css">
	#table tr td{
		font-size:16px;
	}
</style>
</head>

<body>

	<div style="height:auto; margin-top:10px;">
		<table border="0" cellpadding="0" cellspacing="10" id="table" style="margin:auto">
			<caption align="center">部门调动情况</caption>
		</table>
	</div>
	<script type="text/javascript">
		var api=frameElement.api;
		var rowid = api.data.rowid;
		$.ajax({
			url : "/person/seePredept",
			type : "post",
			async:false,
			data : {
				"rowid":rowid
			},
			success:function(data){
				for(var i=0;i<data.length;i++){
					var formatTime = formatDate(data[i].predept.officedate);
					var temp ="<tr><td>"+formatTime+"入职</td><td>在"+data[i].deptname+"上班</td></tr>"
					$("#table").append(temp);
				}
			}
		})
		
		
		function formatDate(time){
			var date = new Date(time);
			var years = date.getFullYear();
			var month = date.getMonth()+1;
			var day = date.getDate();
			if(month<10){
				if(day<10){
					return years+"-0"+month+"-0"+day;
				}else{
					return years+"-0"+month+"-"+day;
				}
			}
			return years+"-"+month+"-"+day;
		}
	</script>
	
</body>
</html>